<?php

use App\Http\Controllers\Api\Admin\AuthController;
use App\Http\Controllers\Api\Admin\PaperController;
use Illuminate\Support\Facades\Route;

// 授权相关
Route::prefix('auth')->group(function () {
    Route::post('login', [AuthController::class, 'login']);

    Route::middleware(['auth:sanctum', 'api.admin'])->group(function () {
        Route::get('me', [AuthController::class, 'me']);
        Route::post('password', [AuthController::class, 'password']);
        Route::post('logout', [AuthController::class, 'logout']);
    });
});

Route::middleware(['auth:sanctum', 'api.admin'])->group(function () {
    Route::prefix('papers')->group(function () {
        Route::get('', [PaperController::class, 'index']);
        Route::get('/detail', [PaperController::class, 'show']);
        Route::post('', [PaperController::class, 'store']);
        Route::post('/{id}/delete', [PaperController::class, 'destroy']);
    });
});
